import * as echarts from 'echarts'
const colorList = [
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    {
      offset: 1,
      color: 'rgba(24, 144, 255, 0.35)'
    },
    {
      offset: 0,
      color: 'rgba(24, 144, 255, 1)'
    }
  ]),
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    {
      offset: 1,
      color: '#00B2FF'
    },
    {
      offset: 1,
      color: '#00B2FF'
    }
  ]),
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    {
      offset: 1,
      color: '#81E2FF'
    },
    {
      offset: 1,
      color: '#81E2FF'
    }
  ])
]
export default (tp = 0) => ({
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow',
    }
  },

  grid: {
    z: 0,
    left: '20',
    top: '5%',
    right: '10',
    bottom: '15%',
    containLabel: true
  },

  xAxis: {
    data: [],
    axisLine: {
      show: false, // 隐藏X轴轴线
      lineStyle: {
        color: '#E5E6EB'
      }
    },
    axisTick: {
      show: false // 隐藏X轴刻度
    },
    axisLabel: {
      show: true,
      textStyle: {
        color: '#86909C' // X轴文字颜色
      }
    }
  },
  yAxis: [
    {
      type: 'value',
      axisLabel: {
        show: true,
        textStyle: {
          color: '#86909C'
        }
      },
      nameTextStyle: {
        color: '#86909C'
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: ['#86909C'],
          type: 'dashed',
          opacity: 0.2
        }
      },
      axisTick: {
        show: false
      },
      axisLine: {
        show: false
      }
    }

  ],
  series: [
    {
      name: '数量',
      type: 'bar',
      barWidth: 20,
      itemStyle: {
        normal: {
          color: colorList[tp]
        }
      },
      data: []
    }
  ]
}
)
